package com.dcjt.firehotcarpad.adapter

import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import com.dcjt.firecommand.manager.endAddressZT
import com.dcjt.firehotcarpad.R
import com.dcjt.firehotcarpad.entity.DisasterInfoEntity


/**
 * 出差出访列表
 */
class DisasterListAdapter(data: List<DisasterInfoEntity>?)
    : BaseQuickAdapter<DisasterInfoEntity, BaseViewHolder>(R.layout.item_disaster_list, data) {

    override fun convert(helper: BaseViewHolder?, item: DisasterInfoEntity?) {

        item.let {
            helper?.run {
                setText(R.id.tv_num,(helper.adapterPosition+1).toString())
                setText(R.id.tv_name, item?.xzqmc+ ""+item?.ajdjmc+ ""+item?.ajlxmc)
                setText(R.id.tv_address,item?.sfdz)
                setText(R.id.tv_time,item?.bjsj)
                setText(R.id.tv_jigou,item?.zgdw)
                setText(R.id.rtv_zt,item?.ajztmc)


                when (item?.ajlx) {
                    "10000" -> setImageResource(R.id.iv_ajlx,endAddressZT[1])
                    "20000" -> setImageResource(R.id.iv_ajlx,endAddressZT[2])
                    "30000" -> setImageResource(R.id.iv_ajlx,endAddressZT[3])
                    "40000" -> setImageResource(R.id.iv_ajlx,endAddressZT[4])
                    "50000" -> setImageResource(R.id.iv_ajlx,endAddressZT[5])
                    else -> setImageResource(R.id.iv_ajlx,endAddressZT[6])
                }

            }
        }
    }
}